package ar.edu.itba.it.cg.grupo01.impl;

import java.util.Iterator;

import javax.vecmath.Point3d;
import javax.vecmath.Vector3d;

public class CameraFactory {

	private static CameraFactory cameraFactory = null;

	// Singleton Pattern
	private CameraFactory() {
	}

	public static CameraFactory getInstance() {
		if (cameraFactory == null) {
			cameraFactory = new CameraFactory();
		}

		return cameraFactory;
	}

	public Camera getCamera(Point3d origin, Vector3d viewingDirection,
			Vector3d upVector, int resX, int resY, double fov,
			Iterator<CameraRay> rayIterator) {
		Camera camera = new Camera(origin, viewingDirection, upVector, resX,
				resY, fov);
		camera.setIterator(rayIterator);
		return camera;
	}

	public Camera getDefaultCamera(int resX, int resY, double fov) {
		
		//TODO esta es la original
		//Point3d origin = new Point3d(0.0, 0.0, 10.0);
		//Vector3d viewingDirection = new Vector3d(0.0, 0.0, -1.0);
		//Vector3d upVector = new Vector3d(0.0, 1.0, 0.0);
		
		Point3d origin = new Point3d(0.0, 0.0, 10.0);
		Vector3d viewingDirection = new Vector3d(0.0, 0.0, -1.0);
		Vector3d upVector = new Vector3d(0.0, 1.0, 0.0);

		return new Camera(origin, viewingDirection, upVector, resX, resY, fov);
	}

}
